package dk.mirasola.systemtraining.bridgewidgets.shared.model.distributionfiltertree;


public final class LogicOperatorGroupItem extends GroupItem {
    private LogicOperator logicOperator = LogicOperator.AND;

    public LogicOperatorGroupItem() {
    }

    public LogicOperatorGroupItem(LogicOperator logicOperator) {
        setLogicOperator(logicOperator);
    }

    public LogicOperator getLogicOperator() {
        return logicOperator;
    }

    public void setLogicOperator(LogicOperator logicOperator) {
        if (logicOperator == null) {
            throw new NullPointerException();
        }
        this.logicOperator = logicOperator;
    }

    @Override
    public boolean isCopy(GroupItem groupItem) {
        if (this == groupItem) return false;
        if (!(groupItem instanceof LogicOperatorGroupItem)) return false;

        LogicOperatorGroupItem item = (LogicOperatorGroupItem) groupItem;
        return logicOperator == item.logicOperator;
    }

    @Override
    public LogicOperatorGroupItem copy() {
        return new LogicOperatorGroupItem(this.logicOperator);
    }
}
